package com.qky.dao.postDao;

import com.qky.dao.utilDao.CurrentSessionDao;
import com.qky.model.post.Post;

import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

@Repository
public class PostDao extends CurrentSessionDao{
	/*public List<Post> getPostListBySearchMap(Map<String,String> searchMap) {
		Criteria criteria=currentSession().createCriteria(Post.class);
		for (Entry<String,String> entry : searchMap.entrySet()) {//遍历query 条件
            //System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());  
            String key =  entry.getKey() ;
            String valueString = entry.getValue();
            if (valueString.split(",").length>1) {
            	String [] valuesArray;
            	valuesArray=valueString.split(",");
            	criteria.add(Restrictions.in(key,valuesArray));
            }else {
            	if (key.equals(anObject)) {
					
				}
            	criteria.add(Restrictions.eq(key,valueString));
            }
		}
		List<Post> list=criteria.list();
		return list;
	}*/
}
